Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix undefined reference to "WebSocket" for NodeJS instances #762

Merged
merged 2 commits into from
Aug 12, 2024

Conversation

mhosmar-cpr
Copy link
Contributor

@mhosmar-cpr mhosmar-cpr commented Jul 22, 2024

Public API Changes
None

Description
Fixed an undefined reference to WebSocket in src/core/Ros.js. This is a fairly direct approach. We could also rearrange the logic to reference ws.WebSocket.CLOSED on the NodeJS branch. see the issue.

Resolves #756

@MatthijsBurgh
Copy link
Contributor

@EzraBrooks do we want to solve it this way, or do we need to import the websocket class here?

Copy link
Contributor

@EzraBrooks EzraBrooks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @mhosmar-cpr! I missed this bug while writing this shim because we don't have unit tests that cover this code path - do you have time to add one?

I also think that we should probably move this condition one layer down as you and @MatthijsBurgh described - even though it's duplicative, it at least is super clear where the magic number comes from if we do that.

@mhosmar-cpr
Copy link
Contributor Author

I have implemented the change as described. However I am not sure of the potential cost of repeatedly importing ws. If it does not pose any risk I think this change is good as is.

Unfortunately I don't have the knowledge or time to implement a unit test for this code path. Please understand.

@mhosmar-cpr
Copy link
Contributor Author

looping back. FYI I can't merge even with approval.

@EzraBrooks
Copy link
Contributor

Running CI and will merge once it passes

@EzraBrooks EzraBrooks merged commit b2818e7 into RobotWebTools:develop Aug 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node.js: ReferenceError: WebSocket is not defined
3 participants